package com.sheep.boot;

import com.sheep.boot.model.MyCar;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author wangze
 * @date 2021-04-04 20:50.
 **/
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(basePackages = "com.sheep.boot")
public class MainApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(MainApplication.class, args);
//		System.out.println(context.getBeanDefinitionCount());
//		MyCar myCar=  (MyCar) context.getBean("myTomCar");
//		System.out.println(myCar.getPrice().doubleValue());
//		System.out.println(myCar.getBrand());

		System.out.println(context.containsBean("mytest"));
	}
}
